home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1991 / 04 / v_destro.c < prev    next >
C/C++ Source or Header  |  1991-05-03  |  482b  |  20 lines

  1. /*    v_destroy.c- Destroy a viewport */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <conio.h>
  6. #include <tools/viewport.h>
  7.  
  8. int v_destroy ( viewport *v )
  9. {
  10.     /* Destroy the viewport, freeing all internally allocated memory, but
  11.      * do not free the viewport itself.
  12.      */
  13.  
  14.     if( v->magic != VMAGIC ){ return 0;  }
  15.     if( !v->closed         ){ v_close( v );  }
  16.  
  17.     v->magic = ~VMAGIC;      /* guaranteed not to be the same as VMAGIC */
  18.     return 1;
  19. }
  20.